package com.apes.fn.tms.repository;

import com.apes.fn.tms.model.BranchLine;
import com.apes.fn.tms.model.Chauffeur;
import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

public interface ChauffeurRepository extends CustomRepository<Chauffeur, String> {

    Chauffeur findByMobileNumber(String mobileNumber);

    @Query(value = "select t.* from  from tms_chauffeur t where t.id not in (" +
            "  select c.chauffeur_id from  TMS_CAR_INFORMATION c" +
            " where c.chauffeur_id = t.id" +
            "   and c.status = 'assigned' )" +
            "   and t.employee_state_id = '000088'",nativeQuery = true)
    Page<Chauffeur> findAllByAssigned( Pageable pageable);
}
